package jmx;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;

import jmx.standardmbean.TomcatServerController;
import jmx.standardmbean.TomcatServerControllerMBean;

public class JMXAgent {

	public static void main(String args[]) throws Exception {
		TomcatServerControllerMBean tomcatServerControllerMBean = new TomcatServerController();
		MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
		ObjectName tomcatServerControllerMBeanName = new ObjectName("com.example:type=TomcatServerController");
		mBeanServer.registerMBean(tomcatServerControllerMBean, tomcatServerControllerMBeanName);
		System.out.println("JMX Agent Running ... ");
		Thread.sleep(Long.MAX_VALUE);
	}

}
